<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>05美女相册</title>
</head>
    <style>
        body {
            font-family: "Helvetica", "Arial", "serif";
            color: #333;
            background-color: #ccc;
            margin: 1em 10%
        }
        h1 {
            color: #333;
            background: transparent;
        }
        a {
            text-decoration: none;
        }
        #imagegallery {
            margin-left: -40px;
            list-style: none;
        }
        #imagegallery li {
            margin: 0px 20px 20px 0;
            padding: 0;
            display: inline;
        }
        #imagegallery li a img {
            border: 0;
        }
    </style>
<body>
    <h2>美女画廊</h2>
    
    <ul id="imagegallery">
        <li><a href="img/1-big.jpg" title="美女A">
            <img src="img/1-small.jpg" width="100" alt="美女1" />    
        </a></li>
        <li><a href="img/2-big.jpg" title="美女B">
            <img src="img/2-small.jpg" width="100" alt="美女4" />    
        </a></li>
        <li><a href="img/3-big.jpg" title="美女C">
            <img src="img/3-small.jpg" width="100" alt="美女4" />    
        </a></li>
        <li><a href="img/4-big.jpg" title="美女D">
            <img src="img/4-small.jpg" width="100" alt="美女4" />    
        </a></li>
    </ul>

    <div>
        
    </div>

    <img id="image" src="img/placeholder.png" alt="" width="450px">

    <p id="des">选择一个图片</p>

    <script src="../jquery-3.2.1.js"></script>
    <script>
        
        // 给所有的a注册点击事件
            $("#imagegallery a").click(function(){
                var href = $(this).attr("href");
                // 修改大图的src
                $("#image").attr("src",href);

                // 修改des的内容
                
                var title = $(this).attr("title");
                $("#des").text(title);

                return false;   // 阻止跳转
            })
    </script>
</body>
</html>